<template>
	<view class="page">
		<view class="yl_img_box">
			<!-- <view style="margin-top:12rpx; margin-bottom: 20rpx;">信用卡综合信息查询</view><br> --><view>卡银通，您的查询管家</view>
		</view>
		<view class="content">
			<view class="content_title" style="border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;color: #333;height: 110rpx;line-height: 110rpx;font-weight: bold;">
				银联商务机综合评分查询系统
			</view>
			<view class="content_center" v-if="type=='search'">
				<input type="text" v-model="user.name" placeholder="请输入姓名" class="content_input" />
				<input type="text" v-model="user.id_card" placeholder="请输入身份证号" class="content_input mt40" maxlength="18" />
				<view class="submit" @click="toSubmit">
					查询
				</view>
			</view>
			<view class="content_center" v-if="type=='result'">
				<view class="result_item">
					<view class="item_title">
						姓 名:
					</view>
					<view class="item_content cg">
						{{resultData.name}}
					</view>
				</view>
				<view class="result_item">
					<view class="item_title">
						评 分:
					</view>
					<view class="item_content" style="color: #f32d12;">
						{{resultData.score}}
					</view>
				</view>
				<view class="result_item">
					<view class="item_title">
						风控等级:
					</view>
					<view class="item_content" style="color: #fe5302;">
						{{resultData.result.level_name}}
					</view>
				</view>
				<view class="result_item" style="align-items: inherit;">
					<view class="item_title">
						原 因:
					</view>
					<view class="item_content" style="font-weight: bold;color: #333;">
						<!-- {{resultData.result.notes}} -->
						<view class="" v-for="(item,index) in resultData.result.notes" :key="index">
							{{ item }}
						</view>
					</view>
				</view>
			</view>
			<view class="content_title" style="border-bottom-left-radius: 20rpx;border-bottom-right-radius: 20rpx;font-family: Arial, Helvetica, sans-serif;font-size: 28rpx;">
				Copyright ©2024
			</view>
		</view>
		<u-modal :show="show2" title="温馨提示" @cancel="show2=false"  cancelText="再逛会" confirmText="去登录" @confirm="toPage"  :showCancelButton="true"  :content='content'>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:'search',
				user:{
					name:'',
					id_card:""
				},
				resultData:[],
				resultNotes: '',
				show2:false,
				content:"此时此刻需要您登录喔～",
			}
		},
		onLoad() {
		},
		onShow() {
			this.show2=false
		},
		methods: {
			toPage(){
				uni.navigateTo({
					url:"/pages/userLogin/index"
				})
			},
			toSubmit(){
				if(!uni.getStorageSync('token')){
					this.show2=true
					return
				}
				if(!this.user.id_card||!this.user.name){
					uni.showToast({
						title: '请先输入姓名和身份证号',
						icon: 'none',
						mask: true,
					})
					return
				}
				this.$request('wechat/query/score','post',this.user).then((res)=>{
					if(res.code==200){
						this.type="result"
						this.resultData=res.data
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	view,input {
		box-sizing: border-box;
	}
	.page {
		height: 100vh;
		background: url(https://orderh5.yt-card.top/images/bg.png);
		background-size: cover;
		padding: 40rpx;
		overflow: hidden;
	}
	.yl_img_box{
		width: 100%;
		padding: 40rpx;
		background-color: #fff;
		border-radius: 30rpx;
		height: 200rpx;
		background: linear-gradient(129deg, #39c4fd, #5498e9, #9c73ed, #4ed8b6);
		color: #fff;
		line-height: 120rpx;
	}
	.yl_img{
		width: 100%;
		height: 115rpx;
	}
	.content{
		width: 100%;
		margin-top: 60rpx;
		.content_title {
			width: 100%;
			height: 90rpx;
			text-align: center;
			line-height: 90rpx;
			color: #666;
			background-color: rgb(245, 245, 245);
		}
		.content_center{
			width: 100%;
			padding: 50rpx 40rpx;
			background-color: #fff;
			.content_input {
				width: 100%;
				border-radius: 44rpx;
				color: #333;
				font-size: 28rpx;
				padding-left: 32rpx;
				border: 1rpx solid #eee;
				height: 88rpx;
			}
			.mt40{
				margin-top: 40rpx;
			}
			.submit{
				width: 100%;
				height: 100rpx;
				background: linear-gradient(129deg, #379efb, #725bf3);
				text-align: center;
				line-height: 100rpx;
				color: #fff;
				font-size: 32rpx;
				margin-top: 60rpx;
				border-radius: 50rpx;
			}
		}
		.result_item{
			display: flex;
			align-items: center;
			margin-top: 30rpx;
			.item_title{
				font-weight: bold;
				font-size:28rpx;
				color: #333;
				width: 200rpx;
			}
			.item_content{
				font-size: 28rpx;
				flex: 1;
			}
			.cg {
				color: green;
			}
		}
	}
</style>